home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 15: Shareware / PC Actual CDT 15.iso / files / Windows_95_98 / Programacion / Java / kinst351a.exe / data1.cab / plugin_samples / KawaPlugin3.java < prev    next >
Encoding:
Java Source  |  2000-02-17  |  2.3 KB  |  78 lines

  1. import java.util.*;
  2. import com.tektools.kawa.plugin.*;
  3.  
  4. /** This command enumerates all the files in each project */
  5. public class KawaPlugin3
  6. {
  7.     public static void main(String[] args)
  8.     {
  9.         KawaApp.build.showWindow(true);
  10.         KawaApp.build.clearWindow();
  11.         for (int i=0;i<args.length;i++)
  12.             KawaApp.build.println("Arg["+i+"] - "+args[i]);
  13.         String[] files = new String[100];    
  14.         int count=0;
  15.         Enumeration enum = KawaApp.enumerateProjects();
  16.         while(enum.hasMoreElements())
  17.         {
  18.             KawaProject proj = (KawaProject)enum.nextElement();            
  19.             if(proj != null)
  20.             {
  21.                 if (!proj.isOpen()) continue;
  22.                 KawaApp.build.println("Name - "+proj.getName()+" Path - "+proj.getPath());
  23.                 // Enumerate all files in the project...
  24.                 Enumeration fileEnum = proj.enumerateAllFiles();
  25.                 while(fileEnum.hasMoreElements())
  26.                 {
  27.                     KawaFile file = (KawaFile)fileEnum.nextElement();
  28.                     if(file != null)
  29.                     {
  30.                         KawaApp.build.println("\t\t" + file.getPath() + "(" + file.isDirty() + ")");
  31.                         if (proj.isOpen())
  32.                         {
  33.                             files[count++]=file.getPath();
  34.                             KawaApp.build.println("Package - "+file.getPackageName());
  35.                             String[] classes = file.getClassNames();
  36.                             for (int j=0;classes != null && j<classes.length;j++)
  37.                                  KawaApp.build.println("        Class - ["+classes[j]+"]");
  38.                             file.setDirty(false);     
  39.                         }
  40.                     }
  41.                 }
  42.                 // Enumerate all folders in the project...
  43.                 Enumeration folderEnum = proj.enumerateFolders();
  44.                 while(folderEnum.hasMoreElements())
  45.                 {
  46.                     KawaFolder folder = (KawaFolder)folderEnum.nextElement();
  47.                     //enumerateFolder(folder);
  48.                 }
  49.             }
  50.         }
  51.         System.out.println("End...");
  52.     }
  53.     
  54.     static protected void enumerateFolder(KawaFolder folder)
  55.     {
  56.         if(folder != null)
  57.         {
  58.             KawaApp.build.println("\tFolder - [" + folder.getName() + "]");
  59.             // Enumerate all files in the folder...
  60.             Enumeration fileEnum = folder.enumerateRootFiles();
  61.             while(fileEnum.hasMoreElements())
  62.             {
  63.                 KawaFile file = (KawaFile)fileEnum.nextElement();
  64.                 if(file != null)
  65.                 {
  66.                     KawaApp.build.println("\t\t" + file.getPath());
  67.                 }
  68.             }
  69.             // Enumerate all folders in the project...
  70.             Enumeration folderEnum = folder.enumerateFolders();
  71.             while(folderEnum.hasMoreElements())
  72.             {
  73.                 KawaFolder fld = (KawaFolder)folderEnum.nextElement();
  74.                 enumerateFolder(fld);
  75.             }
  76.         }
  77.     }
  78. }